﻿using Sys.Api;
using Sys.Core.Dri;
using Sys.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_dri_exercise_Edit : PageBase
{
    public DriExercise model { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request.QueryString["id"];

            if (string.IsNullOrEmpty(id))
            {
                model = new DriExercise();

                //model.Num = ExerciseBll.I.NewNum;  //产生新的流水号

                //model.Top = false;
                //model.Img = string.Empty;

                //如果是从学员管理进入练习，则表示新增练习
                string studentID = Request.QueryString["studentID"];
                if (!string.IsNullOrEmpty(studentID))
                {
                    model.StudentID = studentID;
                    model.StudentInfo = StudentBll.I.GetInfoByID(model.StudentID);
                    model.StartTime = DateTime.Now.ToString("yyyy-MM-dd") + " 09:00:00";
                    model.EndTime = DateTime.Now.ToString("yyyy-MM-dd") + " 17:00:00";
                    model.InsertTime = model.ConfirmTime = DateTime.Now;
                    model.IsVisible = true;
                }
            }
            else
            {
                model = ExerciseBll.I.GetByKey(id);
                model.StudentInfo = StudentBll.I.GetInfoByID(model.StudentID);
            }


        }
    }
}